﻿using System;
using RayDen.Library.Components.Surface;
using RayDen.Library.Core;
using RayDen.Library.Core.Primitives;

namespace RayDen.RayEngine.AdvancedMaterials
{
    [Serializable]
    public class LambertianBrdf : ElementaryBrdf
    {

        private RgbSpectrum KdOverPi;

        public override BrdfType Type
        {
            get { return BrdfType.Diffuse; }
        }

        public override bool IsDiffuse()
        {
            return true;
        }

        public override bool IsSpecular()
        {
            return false;
        }

        protected override void EvalTexture(ref SurfaceTextureData data)
        {
            this.KdOverPi = MathLab.INVPI*data.Diffuse;
        }

        public override void f(ref Vector wo, ref Vector wi, ref Normal N, out RgbSpectrum fs)
        {
            fs = KdOverPi;

        }
    }
}